package com.pbteach.shopping.controller;

/**
 * @ClassName SellerController
 * @Description: TODO
 * @Author wgc
 * @Date 2020/06/13 16:46
 * @Version V1.0
 **/

import com.pbteach.shopping.entity.ProductInfo;
import com.pbteach.shopping.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 卖家商品展示
 */
@RestController
public class SellerController {

    @Autowired
    private ProductService productService;

    @PostMapping("/products")
    public String createProject(@RequestBody ProductInfo productInfo) {
        productService.createProduct(productInfo);
        return "创建成功!";
    }
    @GetMapping(value = "/products/{page}/{pageSize}")
    public List<ProductInfo> queryProduct(@PathVariable("page")int page, @PathVariable("pageSize")int pageSize){

        return productService.queryProduct(page,pageSize);
    }
}